<% if !flash[:success].nil? %>
<div class='alert alert-success fade in'><%= flash[:success] %></div>
<% elsif !flash[:error].nil? %>
<div class='alert alert-error fade in'><%= flash[:success] %></div>
<% end  %>
<table class="table table-striped" >
    <tr >
      <th>Id</th>
      <th>User Name</th>
      <th>User Avatar</th>
      <th>User Type</th>
      <th colspan='3'>Action</th>
    </tr>

  <% @user.each do |user| %>
    <tr >
      <td><%= user.user_id %></td>
      <td><%= image_tag show_avatar(user[:avatar]),:onerror => "this.src='/data/no-image.jpg'", :class => "img-polaroid", :width => "80" %></td>
      <td><%= user.username %></td>
      <td><% if  user.user_type==1%>
                    Admin
              <%  else %>
                    User
              <% end %>
      </td>
      <td><%= link_to 'Edit', user_profile_path(user) %></td>
      <td><%= link_to 'Destroy', delete_user_path(user), :method => :delete, :onclick => 'return confirm("Are You sure?")' %></td>
    </tr>
  <% end %>
  </table>

